Error in writting xml : “error on line 20 at column 1: Extra content at the end of the document”

Çözüm Write Metodundan sonra Response.End()  metodunu  çağırmaktır.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;


public partial class xmlData : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {


        Response.ContentType = "text/xml"; 
        String xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"+
                     "<note>"+
                         "<to>Ahmet</to>"+
                         "<from>Mustafa</from>"+
                         "<heading>Hatırlatıcı</heading>"+
                         "<body>Hafta Sonunu Unutma</body>"+
                      "</note>";


        Response.Write(xml);


    }
}



Yorum :
Sende yorum kat..